package com.demo.travel.activity;

import android.os.Bundle;
import android.provider.ContactsContract;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.demo.travel.R;
import com.demo.travel.adapter.ImageAdapter;
import com.demo.travel.base.BaseActivity;
import com.demo.travel.bean.ItemBean;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class EventDetailActivity extends BaseActivity {


    @BindView(R.id.backIv)
    ImageView backIv;
    @BindView(R.id.shareTv)
    TextView shareTv;
    @BindView(R.id.imageView)
    ImageView imageView;
    @BindView(R.id.title1Tv)
    TextView title1Tv;
    @BindView(R.id.recyclerview)
    RecyclerView recyclerview;
    @BindView(R.id.contentTv)
    TextView contentTv;

    private ItemBean itemBean;

    private ImageAdapter imageAdapter;

    @Override
    protected int initLayout() {
        return R.layout.activity_event_detail;
    }

    @Override
    protected void initView() {
        itemBean = (ItemBean) getIntent().getSerializableExtra("itemBean");
        shareTv.setVisibility(View.VISIBLE);
        backIv.setVisibility(View.VISIBLE);
        title1Tv.setText(itemBean.getTitle());
        imageView.setImageResource(itemBean.getImage());
        contentTv.setText(itemBean.getContent());

        imageAdapter = new ImageAdapter();
        recyclerview.setLayoutManager(new LinearLayoutManager(this, RecyclerView.HORIZONTAL, false));
        recyclerview.setAdapter(imageAdapter);

        ItemBean itemBean1 = new ItemBean();
        itemBean1.setImage(R.mipmap.hd1);
        ItemBean itemBean2 = new ItemBean();
        itemBean2.setImage(R.mipmap.hd2);
        ItemBean itemBean3 = new ItemBean();
        itemBean3.setImage(R.mipmap.hd3);
        ItemBean itemBean4 = new ItemBean();
        itemBean4.setImage(R.mipmap.badaling);
        ItemBean itemBean5 = new ItemBean();
        itemBean5.setImage(R.mipmap.guju);
        ItemBean itemBean6 = new ItemBean();
        itemBean6.setImage(R.mipmap.dafos);

        imageAdapter.addData(itemBean1);
        imageAdapter.addData(itemBean2);
        imageAdapter.addData(itemBean3);
        imageAdapter.addData(itemBean4);
        imageAdapter.addData(itemBean5);
        imageAdapter.addData(itemBean6);
    }

    @Override
    protected void initData() {

    }

    @Override
    public String getActivityTitle() {
        return "活动详情";
    }

    @OnClick(R.id.backIv)
    public void onClick(View view){
        switch (view.getId()) {
            case R.id.backIv:
                finish();
                break;
        }
    }

}
